package org.scboy.dbms.valid.datatype;

import java.util.List;

import org.scboy.dbms.annotation.ValidType;
import org.scboy.dbms.entity.ParamConfig;
import org.scboy.dbms.valid.Valid;
import org.scboy.dbms.valid.common.RegxValid;
import org.scboy.utils.entitys.coobi.Model;

@ValidType("座机")
public class MobileValid extends RegxValid implements Valid {
	String regex = "^(\\d{3,4}-)?\\d{6,8}$";
	@Override
	public List<ParamConfig> config() {
		return null;
	}
	
	@Override
	public String toString(Model config) {
		return "座机号码不正确（区号-号码）";
	}
	
	@Override
	public boolean valid(Object value,Model model, Model config) {
		config=Model.create();
		config.put("expression", regex);
		return super.valid(value,model, config);
	}
}
